#include "CFileInfo.h"
#include <QJSEngine>
CFileInfo::CFileInfo(QObject *parent)
    : QObject{parent}
{

}

QJSValue CFileInfo::get(const QJSValue &index) const
{
    FileInfo info;
    info.fileName = "/home/user/hello.txt";
    info.isFile = true;
    info.size = 100;

//    QJSEngine *jsEngine = index.engine();

    QJSEngine jsEngine;


    QJSValue object = jsEngine.newObject();

#define XX(name,value) object.setProperty(name,jsEngine.toScriptValue(QVariant(value)))
    XX("fileName",info.fileName);
    XX("isFile",info.isFile);
    XX("size",info.size);
#undef XX

    return object;
}
